home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / cc / sprite / specs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-18  |  11.8 KB  |  329 lines

  1. /*
  2.  * specs.h --
  3.  *
  4.  *    This file is included by gcc.c, and defines the compilation
  5.  *    and linking specs for each of the target machines for which
  6.  *    gcc can currently generate code.
  7.  *
  8.  * Copyright 1988 Regents of the University of California
  9.  * Permission to use, copy, modify, and distribute this
  10.  * software and its documentation for any purpose and without
  11.  * fee is hereby granted, provided that the above copyright
  12.  * notice appear in all copies.  The University of California
  13.  * makes no representations about the suitability of this
  14.  * software for any purpose.  It is provided "as is" without
  15.  * express or implied warranty.
  16.  *
  17.  * $Header: /sprite/src/cmds/cc/sprite/RCS/specs.h,v 1.18 91/09/12 15:40:39 rab Exp Locker: rab $ SPRITE (Berkeley)
  18.  */
  19.  
  20. #ifndef _SPECS
  21. #define _SPECS
  22.  
  23. /* This structure says how to run one compiler, and when to do so.  */
  24.  
  25. struct compiler
  26. {
  27.   char *suffix;            /* Use this compiler for input files
  28.                    whose names end in this suffix.  */
  29.   char *spec;            /* To use this compiler, pass this spec
  30.                    to do_spec.  */
  31. };
  32.  
  33. /*
  34.  * One of the following structures exists for each machine for
  35.  * which gcc can generate code.  It gives all the spec-related
  36.  * information for compiling for tha target.
  37.  */
  38.  
  39. typedef struct
  40. {
  41.     char *name;                /* Official name of this target
  42.                      * machine (many -m switches may
  43.                      * map to the same entry). */
  44.     struct compiler *base_specs;    /* List of specs to use when compiling
  45.                      * for this target machine.  Last
  46.                      * compiler must be all zeros to
  47.                      * indicate end of list. */
  48.     struct compiler *cplusplus_specs;   /* List of specs to use when invoked                               as a c++ compiler */
  49.     char *link_base_spec;        /* Basic spec to use to link for this
  50.                      * target. */
  51.     char *cpp_predefines;        /* Spec to substitute for %p. */
  52.     char *cpp_spec;            /* Spec to substitute for %C. */
  53.     char *cc1_spec;                     /* Spec to substitute for %1. */
  54.     char *cplus1_spec;                  /* Spec to substitute for %+  */
  55.     char *asm_spec;            /* Spec to substitute for %a. */
  56.     char *link_spec;            /* Spec to substitute for %l. */
  57.     char *lib_spec;            /* Spec to substitute for %L. */
  58.     char *startfile_spec;        /* Spec to substitute for %S. */
  59.     char *signed_char_spec;             /* Spec to substitute for %c. */
  60. } target_specs;
  61.  
  62. static char default_assembler_string[] = 
  63.      "%{!E:%{!S:%a %{R} %{j} %{J} %{h} %{d2}\
  64.     %i %{c:%{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\n }}\
  65.       %{E:%C %{nostdinc} %{C} %{v} %{D*} %{U*} %{I*} -m%m %{M*} %{T} \
  66.         -undef -D__GNUC__ %{ansi: -$ -D__STRICT_ANSI__}\
  67.     %{!ansi:%p -Dunix -Dsprite}\
  68.         %{O:-D__OPTIMIZE__} %{traditional} %{pedantic}\
  69.     %{Wcomment} %{Wtrigraphs} %{Wall}\
  70.         %i %{o*} %{M*:%{o*}}}\n";
  71.  
  72. static char default_c_string[] =
  73.      "%C %{nostdinc} %{C} %{v} %{D*} %{U*} %{I*} -m%m %{M*} %{T} \
  74.         -undef -D__GNUC__ %{ansi: -$ -D__STRICT_ANSI__}\
  75.     %{!ansi:%p -Dunix -Dsprite}\
  76.     %{msoft-float:-D__SOFT_FLOAT__}\
  77.         %{O:-D__OPTIMIZE__} %{traditional} %{pedantic}\
  78.     %{Wcomment} %{Wtrigraphs} %{Wall}\
  79.         %i %{!M*:%{!E:%g.cpp}}%{E:%{o*}}%{M*:%{o*}}\n\
  80.      %{!M*:%{!E:%1 %g.cpp %{!Q:-quiet} -dumpbase %i %{Y*} %{d*} %{m*} %{f*}\
  81.     %{a} %{g} %{O} %{W*} %{w} %{pedantic} %{ansi} %{traditional}\
  82.     %{v:-version} %{gg:-symout %g.sym} %{pg:-p} %{p}\
  83.         %{S:%{o*}%{!o*:-o %b.s}}%{!S:-o %g.s}\n\
  84.      %{!S:%a %{R} %{j} %{J} %{h} %{d2} %{gg:-G %g.sym}\
  85.     %g.s %{c:%{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\n }}}";
  86.  
  87. static char default_cplusplus_string[] = 
  88.     "%C -+ %{nostdinc} %{C} %{v} %{D*} %{U*} %{I*} \
  89.        -I/sprite/lib/include/g++ -m%m %{M*} %{T} \
  90.        -undef -D__GNUC__ -D__GNUG__ -D__cplusplus %p -Dsprite %P\
  91.        %c %{O:-D__OPTIMIZE__} %{traditional} %{pedantic}\
  92.        %{Wcomment*} %{Wtrigraphs} %{Wall}\
  93.        %i %{!M*:%{!E:%g.cpp}}%{E:%{o*}}%{M*:%{o*}}\n\
  94.      %{!M*:%{!E:%+ %g.cpp %{!Q:-quiet} -dumpbase %i %{Y*} %{d*} %{m*} %{f*}\
  95.     %{+e*} %{a} %{g} %{g0} %{O} %{W*} %{w} %{pedantic} %{traditional}\
  96.     %{v:-version} %{gg:-symout %g.sym} %{pg:-p} %{p}\
  97.         %{S:%{o*}%{!o*:-o %b.s}}%{!S:-o %g.s}\n\
  98.      %{!S:%a %{R} %{j} %{J} %{h} %{d2} %{gg:-G %g.sym}\
  99.     %g.s %{c:%{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\n }}}";
  100.  
  101. /*
  102.  * Spec information for individual machines:
  103.  */
  104.  
  105. static struct compiler default_compilers[] =
  106. {
  107.     {".c", default_c_string },
  108.     {".cc", default_cplusplus_string },
  109.     {".s", default_assembler_string },
  110.     /* Mark end of table. */
  111.     {0, 0}
  112. };
  113.  
  114. static struct compiler default_cplusplus[] =
  115. {
  116.     {".c", default_cplusplus_string },
  117.     {".cc", default_cplusplus_string },
  118.     {".s", default_assembler_string },
  119.     /* Mark end of table. */
  120.     {0, 0},
  121. };
  122.  
  123. #if 0
  124. static struct compiler sun3_compilers[] =
  125. {
  126.     {".c",
  127.      "%C %{nostdinc} %{C} %{v} %{D*} %{U*} %{I*} -m%m %{M*} %{T} \
  128.         -undef -D__GNUC__ %{ansi: -$ -D__STRICT_ANSI__}\
  129.     %{!ansi:%p -Dunix -Dsprite}\
  130.     %{!m68881:-D__SOFT_FLOAT__}\
  131.         %{O:-D__OPTIMIZE__} %{traditional} %{pedantic}\
  132.     %{Wcomment} %{Wtrigraphs} %{Wall}\
  133.         %i %{!M*:%{!E:%g.cpp}}%{E:%{o*}}%{M*:%{o*}}\n\
  134.      %{!M*:%{!E:%1 %g.cpp %{!Q:-quiet} -dumpbase %i %{Y*} %{d*} %{m*} %{f*}\
  135.     %{a} %{g} %{O} %{W*} %{w} %{pedantic} %{ansi} %{traditional}\
  136.     %{v:-version} %{gg:-symout %g.sym} %{pg:-p} %{p}\
  137.     %{!m68881:-msoft-float}\
  138.         %{S:%{o*}%{!o*:-o %b.s}}%{!S:-o %g.s}\n\
  139.      %{!S:%a %{R} %{j} %{J} %{h} %{d2} %{gg:-G %g.sym}\
  140.     %g.s %{c:%{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\n }}}"},
  141.     {".s",
  142.      "%{!E:%{!S:%a %{R} %{j} %{J} %{h} %{d2}\
  143.     %i %{c:%{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o}\n }}\
  144.       %{E:%C %{nostdinc} %{C} %{v} %{D*} %{U*} %{I*} -m%m %{M*} %{T} \
  145.         -undef -D__GNUC__ %{ansi: -$ -D__STRICT_ANSI__}\
  146.     %{!ansi:%p -Dunix -Dsprite}\
  147.         %{O:-D__OPTIMIZE__} %{traditional} %{pedantic}\
  148.     %{Wcomment} %{Wtrigraphs} %{Wall}\
  149.         %i %{o*} %{M*:%{o*}}}\n"},
  150.     /* Mark end of table. */
  151.     {0, 0}
  152. };
  153. #endif
  154.  
  155. static char default_link_spec[] =
  156.     "%{!c:%{!M*:%{!E:%{!S:%l %{o*}\
  157.     %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\
  158.     %{y*} %{!nostdlib:%S} %{L*} -L/sprite/lib/%m.md \
  159.     %o %{!nostdlib:%L}\n }}}}";
  160.  
  161.  
  162. static target_specs m68000_target =
  163. {
  164.     "sun2",                    /* name */
  165.     default_compilers,                /* base_specs */
  166.     default_cplusplus,                          /* c++ specs */
  167.     default_link_spec,                /* link_base_spec */
  168.     "-Dmc68000 -Dsun2",                /* cpp_predefines */
  169.     "cpp",                                      /* cpp_spec */
  170.     "cc1.68k -msoft-float -m68000",        /* cc1_spec */
  171.     "g++1.68k -m68000",                   /* cplus1_spec */
  172.     "as.sun3 -m68010",                /* asm_spec */
  173.     "ld.sun3 -X -m68010 %{!e:-e start}",    /* link_spec */
  174.     "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}",    /* lib_spec */
  175.     "",                        /* start_file_spec */
  176.     "%{funsigned-char: -D__CHAR_UNSIGNED__}",   /* signed_char_spec */
  177. };
  178.  
  179. static target_specs m68020_target =
  180. {
  181.     "sun3",                    /* name */
  182.     default_compilers,                /* base_specs */
  183.     default_cplusplus,                          /* c++ specs */
  184.     default_link_spec,                /* link_base_spec */
  185.     "-Dmc68000 -Dsun3 -Dsun",            /* cpp_predefines */
  186.     "cpp",                                      /* cpp_spec */
  187.     "cc1.68k -m68020",                          /* cc1_spec */
  188.     "g++1.68k -m68020",                          /* cplus1_spec */
  189.     "as.sun3 -m68020",                /* asm_spec */
  190.     "ld.sun3 -X %{!e:%{!pg:-e start}%{pg:-e gstart}}",
  191.                         /* link_spec */    
  192.     "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}",    /* lib_spec */
  193.     "",                        /* start_file_spec */
  194.     "%{funsigned-char: -D__CHAR_UNSIGNED__}",   /* signed_char spec */
  195. };
  196.  
  197. static target_specs spur_target =
  198. {
  199.     "spur",                    /* name */
  200.     default_compilers,                /* base_specs */
  201.     default_cplusplus,                          /* c++ specs */
  202.     default_link_spec,                /* link_base_spec */
  203.     "-Dspur",                    /* cpp_predefines */
  204.     "cpp",                                      /* cpp_spec */
  205.     "cc1.spur -msoft-float",            /* cc1_spec */
  206.     "g++1.spur -msoft-float",                    /* cplus1_spec */
  207.     "sas",                    /* asm_spec */
  208.     "sld -X -p %{!e:-e start}",            /* link_spec */
  209.     "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}",    /* lib_spec */
  210.     "",                        /* start_file_spec */
  211.     "%{funsigned-char: -D__CHAR_UNSIGNED__}",   /* signed_char spec */
  212. };
  213.  
  214. static target_specs sparc_target =
  215. {
  216.     "sun4",                    /* name */
  217.     default_compilers,                /* base_specs */
  218.     default_cplusplus,                          /* c++ specs */
  219.     default_link_spec,                /* link_base_spec */
  220.     "-Dsparc -Dsun4 -Dsun",            /* cpp_predefines */
  221.     "cpp",                                      /* cpp_spec */
  222.     "cc1.sparc",                        /* cc1_spec */
  223.     "g++1.sparc",                                /* cplus1_spec */
  224.     "as.sun4",                         /* asm_spec */
  225.     "ld.sun4 -X %{!e:%{!pg:-e start}%{pg:-e gstart}}",
  226.                         /* link_spec */
  227.     "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}",    /* lib_spec */
  228.     "",                        /* start_file_spec */
  229.     "%{funsigned-char: -D__CHAR_UNSIGNED__}",   /* signed_char spec */
  230. };
  231.  
  232.  
  233. static target_specs mips_target =
  234. {
  235.     "ds3100",                    /* name */
  236.     default_compilers,                /* base_specs */
  237.     default_cplusplus,                          /* c++ specs */
  238.     default_link_spec,                /* link_base_spec */
  239.     "-Dmips -Dds3100",                /* cpp_predefines */
  240.     "cpp",                                      /* cpp_spec */
  241.     "cc1.mips",                         /* cc1_spec */
  242.     "g++1.mips",                                 /* cplus1_spec */
  243. #if 0
  244.     "as.ds3100",                /* asm_spec */
  245.     "ld.ds3100 -X %{!e:%{!pg:-e start}%{pg:-e gstart}}",
  246.                         /* link_spec */
  247. #else
  248.     /* 
  249.      *    For now we have to use the Ultrix assembler and linker.
  250.      *    These will fail on a sun.
  251.      */
  252. #ifdef ds3100
  253.     "/sprite/cmds.ds3100/as",
  254.     "/sprite/cmds.ds3100/ld -B1.31 /usr/lib/crt0.o1.31",
  255. #else
  256.     "echo YOU CANT ASSEMBLE FOR THE DS3100 ON THIS MACHINE",
  257.     "echo YOU CANT LINK FOR THE DS3100 ON THIS MACHINE",
  258. #endif
  259. #endif
  260.     "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}",    /* lib_spec */
  261.     "",                        /* start_file_spec */
  262.     "%{funsigned-char: -D__CHAR_UNSIGNED__}",   /* signed_char spec */
  263. };
  264.  
  265.  
  266. static target_specs symm_target =
  267. {
  268.     "symm",                    /* name */
  269.     default_compilers,                /* base_specs */
  270.     default_cplusplus,                          /* c++ specs */
  271.     default_link_spec,                /* link_base_spec */
  272.     "-Di386 -Dsymm -Dsequent",            /* cpp_predefines */
  273.     "cpp",                                      /* cpp_spec */
  274.     "cc1.symm",                            /* cc1_spec */
  275.     "g++1.symm",                                /* cplus1_spec */
  276.     "as.symm",                         /* asm_spec */
  277.     "ld.symm -Tdata 400000 %{!e:%{!pg:-e __start}%{pg:-e __gstart}}",
  278.                         /* link_spec */
  279.     "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}",    /* lib_spec */
  280.     "",                        /* start_file_spec */
  281.     "%{funsigned-char: -D__CHAR_UNSIGNED__}",   /* signed_char spec */
  282. };
  283.  
  284.  
  285. /*
  286.  * Top-level table used to look up information for a particular target
  287.  * machine.  The first entry will be used as the default target if
  288.  * a target isn't specified in a command-line switch or environment
  289.  * variable.
  290.  */
  291.  
  292. typedef struct
  293. {
  294.     char *name;            /* Name of target machine (as it
  295.                  * appears in "-m" switch. */
  296.     target_specs *info;        /* Information about target machine. */
  297. } target_machine;
  298.  
  299. static target_machine target_machines[] = {
  300.     {"sun3",    &m68020_target},
  301.     {"68000",    &m68000_target},
  302.     {"68010",    &m68000_target},
  303.     {"sun2",    &m68000_target},
  304.     {"68020",    &m68020_target},
  305.     {"spur",    &spur_target},
  306.     {"sun4",    &sparc_target},
  307.     {"sun4c",   &sparc_target},
  308.     {"sun4c2",  &sparc_target},
  309.     {"sparc",   &sparc_target},
  310.     {"ds3100",  &mips_target},
  311.     {"mips",    &mips_target},
  312.     {"sym",     &symm_target},
  313.     {"symm",    &symm_target},
  314.     {"sequent", &symm_target},
  315.     {"i386",    &symm_target},
  316.     {0, 0}                /* Zeroes mark end of list. */
  317. };
  318.  
  319. static char *target_name;        /* Name of selected target. */
  320. static target_specs *target;        /* Info for selected target. */
  321.  
  322. /*
  323.  *  Put temporary files in /tmp
  324.  */
  325. #define P_tmpdir    "/tmp"
  326.  
  327. #endif /* _SPECS */
  328.  
  329.